<form method="POST">
	<div class="form-group">
		<label for="scriptName">Script Name<br>
			<small class="form-text text-muted">
				The name of challenge-build script
			</small>
		</label>
		<input type="text" class="form-control" name="scriptName" placeholder="Enter script name" value="{{ challenge.scriptName }}">
	</div>
	<div class="form-group">
		<label for="dirname">Dirname<br>
			<small class="form-text text-muted">
				The name of your challenge dirname
			</small>
		</label>
		<input type="text" class="form-control" name="dirname" placeholder="Enter challenge dirname" value="{{ challenge.dirname }}">
	</div>


	<div class="form-group">
		<label for="name">Name<br>
			<small class="form-text text-muted">
				The name of your challenge
			</small>
		</label>
		<input type="text" class="form-control" name="name" placeholder="Enter challenge name" value="{{ challenge.name }}">
	</div>
	<div class="form-group">
		<label for="category">Category<br>
			<small class="form-text text-muted">
				The category of your challenge
			</small>
		</label>
		<input type="text" class="form-control" name="category" placeholder="Enter challenge category"  value="{{ challenge.category }}">
	</div>

	<ul class="nav nav-tabs" role="tablist" id="new-desc-edit">
		<li class="nav-item">
			<a class="nav-link active" href="#new-desc-write" aria-controls="home" role="tab"
			   data-toggle="tab">Write</a>
		</li>
		<li class="nav-item">
			<a class="nav-link" href="#new-desc-preview" aria-controls="home" role="tab" data-toggle="tab">Preview</a>
		</li>
	</ul>

	<div class="tab-content">
		<div role="tabpanel" class="tab-pane active" id="new-desc-write">
			<div class="form-group">
				<label for="message-text" class="control-label">Message
					<small class="form-text text-muted">
						Use this to give a brief introduction to your challenge. The description supports HTML and
						Markdown.
					</small>
				</label>
				<textarea id="new-desc-editor" class="form-control" name="description" rows="10">{{ challenge.description }}</textarea>
			</div>
		</div>
		<div role="tabpanel" class="tab-pane content" id="new-desc-preview" style="height:234px; overflow-y: scroll;">
		</div>
	</div>

	<div class="form-group">
		<label for="value">Initial Value<br>
			<small class="form-text text-muted">
				This is how many points the challenge is worth initially.
			</small>
		</label>
		<input type="number" class="form-control" name="value" placeholder="Enter value" value="{{ challenge.initial }}" required>

	</div>

	<div class="form-group">
		<label for="value">Decay Limit<br>
			<small class="form-text text-muted">
				The amount of solves before the challenge reaches its minimum value
			</small>
		</label>
		<input type="number" class="form-control" name="decay" placeholder="Enter decay limit" value="{{ challenge.decay }}" required>
	</div>

	<div class="form-group">
		<label for="value">Minimum Value<br>
			<small class="form-text text-muted">
				This is the lowest that the challenge can be worth
			</small>
		</label>
		<input type="number" class="form-control" name="minimum" placeholder="Enter minimum value" value="{{ challenge.minimum }}" required>

	</div>
	
	<div class="form-group">
		<label>
			Max Attempts<br>
			<small class="form-text text-muted">Maximum amount of attempts users receive. Leave at 0 for unlimited.</small>
		</label>

		<input type="number" class="form-control chal-attempts" name="max_attempts"
			   value="{{ challenge.max_attempts }}">
	</div>

	<div class="form-group">
		<label>
			State<br>
			<small class="form-text text-muted">Changes the state of the challenge (e.g. visible, hidden)</small>
		</label>

		<select class="form-control" name="state">
			<option value="visible" {% if challenge.state == "visible" %}selected{% endif %}>Visible</option>
			<option value="hidden" {% if challenge.state == "hidden" %}selected{% endif %}>Hidden</option>
		</select>
	</div>

	<div>
		<button class="btn btn-success btn-outlined float-right" type="submit">
			Update
		</button>
	</div>
</form>
